package com.geline.mybatisplus.mapper;

import com.baomidou.mybatisplus.extension.toolkit.Db;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;

@Deprecated
@Transactional
@Slf4j
public class MybatisPlusCurdMapper implements CurdMapper{

    @Override
    public <T> boolean save(T entity) {
        return Db.save(entity);
    }

    @Override
    public <T> boolean updateById(T entity) {
        return Db.updateById(entity);
    }

    @Override
    public <T> boolean saveBatch(Collection<T> entityList) {
        return Db.saveBatch(entityList);
    }

    @Override
    public <T> T getById(Serializable id, Class<T> entityClass) {
        return Db.getById(id, entityClass);
    }

    @Override
    public <T> boolean removeById(Object id, Class<T> entityClass) {
        return Db.removeById((Serializable) id, entityClass);
    }

    @Override
    public <T> boolean removeByIds(Collection<?> ids, Class<T> entityClass) {
        return Db.removeByIds((Collection<? extends Serializable>) ids, entityClass);
    }
}
